home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / misc1 / iv26_w30.zip / INTERVIE / MENU.H < prev    next >
C/C++ Source or Header  |  1980-01-03  |  4KB  |  132 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. /*
  24.  * Common menus built on top of controls
  25.  */
  26.  
  27. #ifndef menu_h
  28. #define menu_h
  29.  
  30. #include <InterViews/box.h>
  31. #include <InterViews/control.h>
  32.  
  33. class MenuItem : public Control {
  34. public:
  35.     MenuItem(Interactor*);
  36.     MenuItem(const char* name, Interactor*);
  37.     MenuItem(const char* str, Alignment = Left);
  38.     MenuItem(const char* name, const char* str, Alignment = Left);
  39. private:
  40.     void Init();
  41. };
  42.  
  43. class Menu : public Control {
  44. public:
  45.     Menu(Interactor*);
  46.     Menu(const char* name, Interactor* i);
  47.     ~Menu();
  48.  
  49.     void SetBody(Interactor*);
  50.     Interactor* GetBody() { return body; }
  51.  
  52.     void SetAlign(Alignment);
  53.     Alignment GetAlign() { return align; }
  54.  
  55.     void SetDepth(int);
  56.     int GetDepth() { return depth; }
  57.  
  58.     void SetBodyState(ControlState*);
  59.     ControlState* GetBodyState() { return state; }
  60.  
  61.     void SetScene(Scene*);
  62.     Scene* GetScene() { return scene; }
  63.     virtual void Include(Control*);
  64.  
  65.     virtual void Popup(Event&);
  66.  
  67.     Coord InsertX() { return ins_x; }
  68.     Coord InsertY() { return ins_y; }
  69. protected:
  70.     virtual void Leave();
  71.     virtual void Open();
  72.     virtual void Close();
  73.  
  74.     virtual void Reconfig();
  75.     virtual void Setup();
  76.     virtual void InsertBody(Coord, Coord);
  77. private:
  78.     Interactor* body;
  79.     Scene* scene;
  80.     ControlState* state;
  81.     Interactor* shadow;
  82.     unsigned int depth : 16;
  83.     unsigned int align : 16;
  84.     class World* world;
  85.     Coord ins_x, ins_y;
  86.     Coord rel_x, rel_y;
  87. private:
  88.     void Init();
  89. };
  90.  
  91. class MenuBar : public HBox {
  92. public:
  93.     MenuBar();
  94.     MenuBar(const char* name);
  95.     ~MenuBar();
  96.  
  97.     virtual void Include(Control*);
  98. protected:
  99.     ControlState* state;
  100. private:
  101.     void Init();
  102. };
  103.  
  104. class PulldownMenu : public Menu {
  105. public:
  106.     PulldownMenu(Interactor* i);
  107.     PulldownMenu(const char* name, Interactor* i);
  108.     PulldownMenu(const char* str);
  109.     PulldownMenu(const char* name, const char* str);
  110. private:
  111.     void Init();
  112. };
  113.  
  114. class PullrightMenu : public Menu {
  115. public:
  116.     PullrightMenu(Interactor* i);
  117.     PullrightMenu(const char* name, Interactor* i);
  118.     PullrightMenu(const char* str);
  119.     PullrightMenu(const char* name, const char* str);
  120. private:
  121.     void Init();
  122. };
  123.  
  124. class PopupMenu : public Menu {
  125. public:
  126.     PopupMenu();
  127. private:
  128.     void Init();
  129. };
  130.  
  131. #endif
  132.